CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12)

PROJECT(BaseSocket)

option(C++11_ENABLE "C++11_ENABLE" ON)

IF (C++11_ENABLE)
    IF (APPLE)
    ELSEIF (UNIX)
        SET(CMAKE_C_COMPILER "/opt/rh/devtoolset-2/root/usr/bin/gcc")
        SET(CMAKE_CXX_COMPILER "/opt/rh/devtoolset-2/root/usr/bin/c++")
    ENDIF ()
    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 ")
ELSE ()
    IF (APPLE)
    ELSEIF (UNIX)
        SET(CMAKE_C_COMPILER "/usr/bin/gcc")
        SET(CMAKE_CXX_COMPILER "/usr/bin/c++")
    ENDIF ()
ENDIF ()

MESSAGE("CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")

SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -g -fPIC -Wall -D_REENTRANT -DUSE_APACHE -DNO_STRING_CIPHER ")
SET(TARGET "basesocket")
SET(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../lib/release_linux/libBase)

AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/frame/netserver/ SOURCE_DIRS_NET)
AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/mdf/ SOURCE_DIRS_MDF)
#AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/include/mdf SOURCE_DIRS_MDF_HEADER)
#AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/include/frame/netserver SOURCE_DIRS_NET_HEADER)

INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../include)
#INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../include/frame/netserver)

#ADD_EXECUTABLE(BaseSocket ${SOURCE_DIRS})

ADD_LIBRARY(${TARGET} STATIC ${SOURCE_DIRS_NET} ${SOURCE_DIRS_MDF})

TARGET_LINK_LIBRARIES(${TARGET} -lnsl -lc -lm -lpthread -lstdc++)

